﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:Converters="clr-namespace:Snipps.Converters">

    <ControlTemplate x:Key="ValidationErrorTemplate">
        <AdornedElementPlaceholder Name="adoner"
                                   VerticalAlignment="Center">
            <Grid>
                <Border BorderBrush="{DynamicResource ValidationErrorBrush}"
                        BorderThickness="{DynamicResource BorderThickness}"
                        SnapsToDevicePixels="True">

                    <Grid>

                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=ActualHeight}" />
                        </Grid.ColumnDefinitions>
                        <Border Grid.Column="1"
                                Width="{Binding RelativeSource={RelativeSource TemplatedParent},
                                                Path=ActualHeight}"
                                Height="{Binding RelativeSource={RelativeSource TemplatedParent},
                                                 Path=ActualHeight}"
                                Background="{DynamicResource ValidationErrorBrush}"
                                ToolTip="{Binding ElementName=adoner,
                                                  Path=AdornedElement.(Validation.Errors),
                                                  Converter={Converters:ValidationErrorsToStringConverter}}">
                            <TextBlock HorizontalAlignment="center"
                                       VerticalAlignment="center"
                                       FontWeight="Bold"
                                       Foreground="{DynamicResource BackgroundBrush}"
                                       Text="!" />
                        </Border>
                    </Grid>
                </Border>
            </Grid>
        </AdornedElementPlaceholder>
    </ControlTemplate>
</ResourceDictionary>